#!/usr/bin/env python3

import rospy
from DrEmpower_can.msg import set_id
# import DrEmpower as dr

def callback(data):
    import DrEmpower as dr
    dr.set_id(id_num=data.id_num, new_id=data.new_id)
    rospy.loginfo("set_id_node: new_id[%d]", data.new_id)


def listener():
    rospy.init_node("set_id", anonymous=True)
    rospy.Subscriber("set_id", set_id, callback)
    rospy.spin()


if __name__ == '__main__':
    listener()